﻿/**
<code>
  <author name="Zealic" email="zealic(at)gmail.com" type="Creator"/>
</code>
**/
using System;
using System.Runtime.Serialization;


namespace Zealib.Template
{
    [Serializable]
    public class VariableResolveException : Exception
    {
        public VariableResolveException(string expression)
            : base()
        {
            Expression = expression;
        }

        public VariableResolveException(string expression, string message)
            : base(message)
        {
        }

        protected VariableResolveException(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            string expression = info.GetString("Expression");
            if (expression != null)
            {
                Expression = expression;
            }
        }

        public string Expression
        {
            get;
            set;
        }

        public override void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            if (info == null)
            {
                throw new ArgumentNullException("info");
            }
            base.GetObjectData(info, context);
            info.AddValue("Expression", Expression, typeof(string));
        }

    }
}
